import React from 'react';
import { createBrowserRouter, Navigate } from 'react-router-dom'
const App = React.lazy(() => import('../App'))
const Login = React.lazy(() => import('../pages/Login'))
const Home = React.lazy(() => import('../pages/Home'))
const IsLogin = (e) => {
  const Com = e.children.type
  return sessionStorage.getItem('token') ? <Com></Com> : <Navigate to='/login'></Navigate>
}

const router = createBrowserRouter([
  {
    path: '/', element: <App></App>, children: [
      { path: '/home', element: <Home></Home> },
      { path: '/login', element: <Login></Login> },
      { path: '/', element: <Navigate to='/home'></Navigate> },

    ]
  },

])
export default router